<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="/common/header.jsp" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<!--[if !IE]> -->
<script type="text/javascript">
    if (!!window.ActiveXObject || "ActiveXObject" in window){
    	window.jQuery || document.write("<script src='${ctx}/assets/js/jquery1x.js'>"+"<"+"/script>"); 
    }  
    else{  
    	window.jQuery || document.write("<script src='${ctx}/assets/js/jquery.js'>"+"<"+"/script>"); 
}
</script>
<!-- <![endif]-->

<!--[if IE]>
<script type="text/javascript">
window.jQuery || document.write("<script src='${ctx}/assets/js/jquery1x.js'>"+"<"+"/script>");
</script>
<![endif]-->
<style>
#navbar{background:url(${ctx}/assets/images/indexTopBg.png) no-repeat;background-size:100% 100%;height: 70px;}

</style>

<div id="navbar" class="navbar navbar-default">
			<script type="text/javascript">
			var obj;
			var str="1";
				try{ace.settings.check('navbar' , 'fixed')}catch(e){}
				$(function(){
					//不同角色对应不同系统
					var roleValues=$("#rolevalues");
					defaultRoleId=$("#roleIdVal").val();
					/* if(defaultRoleId=='06'||defaultRoleId=='07'||defaultRoleId=='08'||defaultRoleId=='09'||defaultRoleId=='10'){
					}else{ */
						$("title").html("互联网营销获客支撑系统");
						$("#navbar_title").html("互联网营销获客支撑系统");
					/* } */
					
					
					
					$("#dropdownRoleMenu,#dropdownUserMenu").on("click",function(){
						//debugger;
						if($(this).next().children().size() == 0){
							return false;
						}
						$(this).dropdown();
					});
					
					/* $.ajax({
						url : "${ctx}/userMsgInfo/checkMsgInfo.do",
						async : false,
						type : "POST",
						dataType : "json",
						success : function(data) {
							if (data[0] == "unread") {
								obj=setInterval(function(){ $("#uu").fadeOut(400).fadeIn(400); },850);
								//$("#uu").css('color','blue');
								obj2=setInterval(function(){ $("#zz").fadeOut(400).fadeIn(400); },850);
								str="2";
							}else {
								
							}					
						},
						error: function(data){
							alert(data.responseText);
						}
				   }); */
				});
				function submitForm(formId){
					$("#"+formId).submit();
				}
				function test(){
					clearInterval(obj);
					clearInterval(obj2);
					
					window.location.href = "${ctx}/login.do?#menuId/00147";	

					
				}
				
				function versionclick(){
					alert("版权所有：杭州展鸿科技有限公司 浙ICP备11032903号  咨询热线：0571-86978582");
				}
				//获取当前的roleId
				function getMenuByRoleId(obj){
					roleId=obj.getAttribute("data-roleId");
					$.ajax({
						url : "${ctx}/user/updateUserDefaultRole/"+roleId,
						async : false,
						type : "POST",
						dataType : "json",
					    success: function(ret){	
							window.location.href = "${ctx}/login.do?#menuId/00000";	
					    	window.location.reload();
					    },
					    error: function(ret){
					    	//window.location.reload();
					    }
					});	
					
				}
			</script>
			<div class="navbar-container" id="navbar-container">
				<!-- #section:basics/sidebar.mobile.toggle -->
				<button type="button" class="navbar-toggle menu-toggler pull-left" id="menu-toggler" data-target="#sidebar">
					<span class="sr-only">Toggle sidebar</span>

					<span class="icon-bar"></span>

					<span class="icon-bar"></span>

					<span class="icon-bar"></span>
				</button>

				<!-- /section:basics/sidebar.mobile.toggle -->
				<div class="navbar-header pull-left">
					<!-- #section:basics/navbar.layout.brand -->
					<!-- <a href="#" class="navbar-brand"> -->
						
							<%-- 
							</small><img src="${ctx}/assets/images/indexTopLogo.jpg" height="40"/>
							<font size="5" color="#ffffff" id="navbar_title">互联网营销获客系统</font>
							<font size="2" color="#ffffff">江苏省分行</font> </small>--%>
							
							<div id='navbarLeft' style="height:70px;line-height:70px;display: flex;flex: 1;align-items: center;">
								<img src="${ctx}/assets/images/indexTopLogo.png" height="40" />
								<div style="display:flex;flex-direction: column; height: 70px;line-height: 20px; align-items: center; justify-content: center;">
									<span style="font-size:20px;color:#dcc06d;margin-left: 16px;letter-spacing: 7px;">互联网营销获客支撑系统</span>
									<span style="font-size:13px;color:#bfbfbf;margin-left:10px;margin-top: 4px"><i>Internet Marketing Access System</i></span>
								</div>						
							</div>
							
					<!-- </a> -->

					<!-- /section:basics/navbar.layout.brand -->

					<!-- #section:basics/navbar.toggle -->

					<!-- /section:basics/navbar.toggle -->
				</div>
			    <c:set var="roleList" value="${fns:getRoleList()}"/>
			    <c:set var="defaultRoleId" value="${fns:getUser().defaultRole}"/>
				<!-- 角色列表 -->
				<div class="navbar-buttons navbar-header pull-right" role="navigation">
					<ul class="nav ace-nav">
						<!-- #section:basics/navbar.role_menu -->
						<li class="light-blue">
							<a data-toggle="dropdown" class="dropdown-toggle" style="cursor:pointer;margin-top: 15px;background: none;" title="用户" id="dropdownUserMenu">
								<span class="user-info">
								<c:forEach var="role" items="${roleList}">
									<c:if test="${role.roleId eq defaultRoleId}">
										<small id="uu">${roleList[0].roleName}</small>
										<input type="hidden" value="${roleList[0].roleId}" id="roleIdVal"/>
									</c:if>
								</c:forEach>
								</span>
								<i class="ace-icon fa fa-caret-down"></i>
							</a>
							<ul class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
								<c:forEach var="role" items="${roleList}">
									<c:if test="${role.roleId ne defaultRoleId}">
										<li>
										<a id="rolevalues" data-roleId="${role.roleId}" data-roleName="${role.roleName}" onclick="getMenuByRoleId(this)">
											<i class="ace-icon fa fa-user"></i>
											${role.roleName}
										</a>
										</li>
									</c:if>
								</c:forEach>
								<%-- <li>
									<a href="${ctx}/logout">
										<i class="ace-icon fa fa-power-off"></i>
										注销
									</a>
								</li>
								<li>
									<a onclick="versionclick()">
										<i class="ace-icon fa fa-user"></i>
										版权所有
									</a>
								</li> --%>
							</ul>
						</li>
					</ul>
				</div>
				<!-- 角色列表 -->
				<!-- #section:basics/navbar.dropdown -->
				<div class="navbar-buttons navbar-header pull-right" role="navigation">
					<ul class="nav ace-nav">
						<%-- <li class="red" >
							<a data-toggle="dropdown" class="dropdown-toggle" href="#" id="dropdownRoleMenu">
									<c:forEach var="roleOnline" items="${sessionRoleIdOnlineList}">
										<i class="ace-icon fa fa-user"></i>
										<hw:dictName dictType='D00006' dictCode='${roleOnline}' orgId="*" langCode="zh_CN"/>
										<!-- <#if sessionRoleIdList?size gt 1> -->
										<!-- <c:if test="fn:length(sessionRoleIdOnlineList)>1">
											<i class="ace-icon fa fa-caret-down"></i>
										</c:if> -->
									 </c:forEach>
							</a>
							<ul class="user-menu dropdown-menu-center dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
		                        	<c:forEach var="role" items="${sessionRoleIdList}">
			                              <li>
			                              	
			                              	<a type="input" href="#" onclick="submitForm('${role}')">
			                              	<i class="ace-icon fa fa-user"></i>
			                              		<hw:dictName dictType='D00006' dictCode='${role}' orgId="*" langCode="zh_CN"/>
			                              	</a>
			                              	<form action="${ctx}/login" id="${role}" method="post">
			                              		<input type="hidden" value="${role}" name="roleId"/>
			                              	</form>
			                              </li>	
		                            </c:forEach>
							</ul>
						</li> --%>
						<!-- #section:basics/navbar.user_menu -->
						<li class="light-blue">
							<a data-toggle="dropdown" class="dropdown-toggle" style="cursor:pointer;margin-top: 15px;background: none;" title="用户" id="dropdownUserMenu">
								<!-- <img class="nav-user-photo" src="${ctx}/assets/avatars/user.jpg" alt="Jason's Photo" /> -->
								<span class="user-info">
									<small id="uu">你好,<hw:userName userId="${sessionScope.sessionUserId}" />${fns:getUser().userName}</small>
								</span>

								<i class="ace-icon fa fa-caret-down"></i>
							</a>

							<ul class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
								<!-- <li>
									<a  data-url="menuId/00011" href="#menuId/00011">
										<i class="ace-icon fa fa-cog"></i>
										用户设置
									</a>
								</li>
									
								<li>
									<a href="#page/profile">
										<i class="ace-icon fa fa-user"></i>
										Profile
									</a>
								</li>

								<li class="divider"></li> -->
                               <!--  <li>								
									
									<a onclick="test()" id="zz">
										<i class="ace-icon fa fa-power-off"></i>
										未读消息
									</a>
								</li> -->
								<li>
									<a href="${ctx}/logout">
										<i class="ace-icon fa fa-power-off"></i>
										注销
									</a>
								</li>
								<li>
									<a onclick="versionclick()">
										<i class="ace-icon fa fa-user"></i>
										版权所有
									</a>
								</li>
							</ul>
						</li>

						<!-- /section:basics/navbar.user_menu -->
					</ul>
				</div>

				<!-- /section:basics/navbar.dropdown -->
			</div><!-- /.navbar-container -->
		</div>